package net.dengzixu.java.homework.period14.homework3;

/**
 * @author Deng Zixu <admin@dengzixu.com>
 */
public class Point {
    int x;
    int y;

    /**
     * 点
     *
     * @param x X坐标
     * @param y Y 坐标
     */
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    /**
     * 获取两点距离
     *
     * @param point 计算距离的点
     * @return 距离
     */
    public double distance(Point point) {
        return Math.sqrt(Math.pow(this.x - point.x, 2) + Math.pow(this.y - point.y, 2));
    }

    /**
     * 将当前点移动到目标点
     *
     * @param point 目标点
     */
    public void move(Point point) {
        this.x = point.x;
        this.y = point.y;
    }
}
